package com.myhome.money.base.javaio;

import java.io.*;

/**
 * 字符字节转换
 */
public class CWithBConvert {

    public static void main(String[] args) throws IOException {
        convertByteToChar();
    }

    public static void convertByteToChar() throws IOException {
        File file = new File("D:/javaio/io/test.txt");
        InputStream inputStream = new FileInputStream(file);
        //字符流转换为字节流
        Reader reader = new InputStreamReader(inputStream);
        char[] chars = new char[(int) file.length()];
        reader.read(chars);
        String str = new String(chars);
        System.out.println("结果：" + str);
    }

}
